package mainDemo01;

public class MainDemo4 {
    public static void main(String[] args) {
        int[] arr = {11,22,33,44,55,66,77,88};
        int[] newarr = array(arr,2,5);
        for (int i = 0; i < newarr.length; i++) {
            System.out.print(arr[i] + " ");
        }


    }
    public static int[] array (int[] arr , int from , int to){
        int[] arr1 = new int[to - from];
        int index = 0;
        for (int i = from; i < to; i++) {
            arr1[index] = arr[i];
            index++;
        }
        return  arr1;
    }
}
